<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>评论</title>
    <link rel="stylesheet" href="../../addons/party_member/public/css/weui.min.css">
    <link rel="stylesheet" href="../../addons/party_member/public/css/jquery-weui.min.css">

    <!-- body 最后 -->
    <script src="../../addons/party_member/public/js/jquery.min.js"></script>
    <script src="../../addons/party_member/public/js/jquery-weui.min.js"></script>

    <!-- 如果使用了某些拓展插件还需要额外的JS -->
    <script src="../../addons/party_member/public/js/swiper.min.js"></script>
    <script src="../../addons/party_member/public/js/city-picker.min.js"></script>
    <script src="../../addons/party_member/public/js/function.js"></script>
    <style>
        .box{
        position: absolute;
        width: 100%;
        height: 100%;
        background: url("../addons/party_member/public/image/activityDetail/bg.png") no-repeat ;
        background-size: 100% 100%;
            }
        .table_main{
            display: block;
            height: auto;
            padding: 0 10px;
        }
        .head{
            display: block;
            position: relative;
            width: 100%;
            height: 43px;
            background: #ffffff;
            text-align: center;
            font-size: 18px;
            line-height: 43px;
            font-family: -webkit-body;
            color: #333333;

        }
        .head_return{
            display: inline-block;
            position: absolute;
            left: 10px;
            top: 10px;
            width: 20px;
            height: 23px;
            background: url("../addons/party_member/public/image/evaluation/return.png") no-repeat;
            background-size: 12px 23px;

        }

    </style>
</head>
<body>
<div class="box">
    <div class="head">
        <span class="head_return"></span>
        评论
    </div>
    <div class="table_main">
        <div class="weui-cells weui-cells_form" style="border-radius: 5px" >
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <textarea class="weui-textarea" maxlength="200"  id="text" placeholder="请输入文本" rows="6"></textarea>
                    <div class="weui-textarea-counter"><span id="num">0</span>/200</div>
                </div>

            </div>

        </div>
        <div style="width: 100%;margin-top: 20px">
            <a href="javascript:;" class="weui-btn weui-btn_primary" id="submit">评论</a>
            <a  id="esc" class="weui-btn weui-btn_warn">取消</a>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('#text').keyup(function () {

            var len=$('#text').val().length;
            $('#num').html(len);

        })

        $('#submit').click(function () {
            var text=$('#text').val();
            $.post('{php echo $this->createMobileUrl("discussAjax")}',{
                text:text,
                type:"{$type}",
                id:"{$id}"
            },function (data) {
                if (data['status']){
                    $.toptip(data['result'], 'success');
                    if("{$type}"==1){
                        window.location.href="{php echo $this->createMobileUrl('BranchStyle')}"
                    }else{
                        window.location.href="{php echo $this->createMobileUrl('partyStyle')}"
                    }
                }else{
                    $.toptip(data['result'], 'error');
                }
            },"json")
        })

        $('#esc').click(function () {
            $('#text').val("")
        })

    })


    $(function () {
        $("#esc").click(function () {
            history.back()
        })
    })

</script>
</body>
</html>